<form action="<{link app=b2c ctl=site_search act=result }>" method="post" class="SearchBar  searchBar_<{$widgets_id}>" id="searchbar_<{$widgets_id}>" async="false" >
    <div class="search-input">
        <input type="text" name="search_keywords" placeholder="<{$data.def_key}>" autocompleter="associate_autocomplete_goods:name,goods_id" ac_options="{}" class="key"  />
    </div>
    <button type="submit" class="btn btn-search submit-btn">搜索</button>
</form>
<div class="hot-keywords">
    <span class="red"><{$setting.hotkey}>:</span>
    <{foreach from=$data.search item=toplink key=top_key}>
    <a href="<{$toplink.top_link_url}>"><{$toplink.top_link_title}></a>
    <{/foreach}>
</div>

<script>
    (function(scope){
        scope.getElement('button[type=submit]').addEvent('click', function(e){
            if(scope.getElement('input').value.trim() === '') {
                e.stop();
            }
        });
        var search_keywords = decodeURIComponent(Memory.get('search_key'));
        if(search_keywords == 'null'){
            search_keywords = '';
        }
        //scope.getElement('input[name=search_keywords]').value = search_keywords;

        <{if $associate == 'true'}>
        var path ='<{$env.statics_host_url}>/b2c/statics/js<{if !defined("DEBUG_JS") || !DEBUG_JS}>_mini<{/if}>/';
        $LAB.script(path + 'autocompleter.js').wait(function(){
            var item = scope.getElement('[data-autocompleter]');
            var options = {};
            try {
                options = JSON.decode(item.get('data-autocompleter-options'));
            }catch (e) {}
            Object.merge(options, item.retrieve('autocompleter_options', {}));

            new Autocompleter.Request.JSON(item, "<{link app=b2c ctl=site_search act=associate}>", options);
        });
        <{/if}>
    })($('searchbar_<{$widgets_id}>'));
</script>
